# Time      :8/11/21 5:23 PM
# Author    :siyangxie
# File      :main.py
# Email     :xiesiyang@126.com


import argparse

import yaml

from utils import utils, interface


def run():
    camera = opt.camera
    cam_ip = utils.extract_ip_port(camera)[0]
    sender = interface.Sender(host=opt.cal_host, port=opt.cal_port, cam_ip=cam_ip, cfg=cfg)
    sender.run()

    while True:
        pass


if __name__ == '__main__':
    cfg = yaml.load(open('config/fen-config.yaml'), Loader=yaml.FullLoader)
    parser = argparse.ArgumentParser()
    parser.add_argument('--camera', type=str,
                        default='rtsp://admin:wingo123456@192.168.0.251:554/h264/ch1/main/av_stream')
    parser.add_argument('--cal_host', type=str, default='192.168.21.23', help='calculation host')
    parser.add_argument('--cal_port', type=int, default=25556, help='calculation port')
    opt = parser.parse_args()
    print(opt)

    run()
